<?php
/**
 * Created by PhpStorm
 * author: bxm
 * Date: 2023/3/8
 * Time: 10:03
 */

namespace app\admin\model;

use app\common\model\TimeModel;

class Customer extends TimeModel
{
    protected $name = "customer";

    protected $deleteTime = "delete_time";

    // 设置json类型字段，你需要将字段名称和别名一起加入
    protected $json = ['customer_file','customer_imgs'];

    // 设置JSON数据返回数组
    protected $jsonAssoc = true;

    public function createAdmin()
    {
        return $this->belongsTo('app\common\model\AdminModel','action_admin_id','id')->field(['id,nickname']);
    }
    public function customerChannel()
    {
        return $this->belongsTo('app\common\model\worker\RecommendModel','recommend_id','id')->field(['id,recommend_name']);
    }
    public function customerRecommend()
    {
        return $this->belongsTo('app\common\model\worker\CustomerChannelModel','channel_id','id')->field(['id,name']);
    }
}